import request from '@/utils/request'
/**
 * 部署文件模块
 */
export class deployPlatformApi{
    // 上传文件
    static uploadFile(data: any, onUploadProgress: (progressEvent: any) => void, cancelToken:any) {
        return request(`/deploymentUnit/addMinIO`, {
            method: 'POST',
            data,
            headers: {
                'Content-Type': 'multipart/form-data',
            },
            onUploadProgress: onUploadProgress,
            cancelToken: cancelToken
        })
    }


    // 获取部署平台列表
    static getDeployPlatformList(data:any){
        return request(`/deploymentUnit/pageList`,{
            method:'post',
            data
        })
    }

    // 部署文件条件查询
    static getDeployPlatformListByCondition(data:any){
        return request(`/deploymentUnit/queryList`,{
            method:'post',
            data
        })
    }

    //下发停止部署物运行指令
    static issueStopDeployedNode(data:any){
        return request(`/deploymentUnit/issueStop`,{
            method:'post',
            data
        })
    }

    //下发删除部署物指令    
    static issueDeleteDeployedNode(data:any){
        return request(`/deploymentUnit/issueDelete`,{
            method:'post',
            data
        })
    }

    // 下发部署物指令
    static issueDeployDeployedNode(data:any){
        return request(`/deploymentUnit/issueDownload`,{
            method:'post',
            data
        })
    }


    // 停止运行部署物日志
    static issueStopDeployedNodeLog(data:any){
        return request(`/deploymentUnit/issueStopLog`,{
            method:'post',
            data
        })
    }


    //批量删除部署物文件
    static batchDeleteDeployPlatform(data:any){
        return request(`/deploymentUnit/deleteList`,{
            method:'post',
            data
        })
    }

    // 一键运行部署物
    static issueRunDeployedNode(data:any){
        return request(`/deploymentUnit/issueRun`,{
            method:'post',
            data
        })
    }

    // 新增启动脚本
    static addStartupScript(data:any){
        return request(`/deploymentUnit/addStartScript`,{
            method: 'POST',
            data,
            headers: {
                'Content-Type': 'multipart/form-data',
            },
        })
    }

    //获取部署数量
    static getDeployPlatformCount(){
        return request(`/deploymentUnit/getDeployCount`,{
            method:'post',
        })
    }
}
